package com.qf.dao;

import com.qf.pojo.User;
import com.qf.utils.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * @author 86199
 * @version V1.0
 * @Project jqueryDemo
 * @Package com.qf.dao
 * @Description:
 * @Date 2022/5/27 13:56
 */
public class UserDaoImpl implements UserDao {
    private QueryRunner runner = new QueryRunner(DBUtil.getDateSource());
    @Override
    public User selectUser(String username, String password) {
        String sql = "select * from t_user where username=? and password = ?";
        try {
            return runner.query(sql,new BeanHandler<>(User.class),username,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    }

